package com.xt.core.dao;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;

import org.appfuse.dao.GenericDao;

import com.xt.core.data.BasicDBObject;
import com.xt.core.helper.page.Pager;

import com.xt.core.exception.ObjectCanNotSaveException;

/**
 * Generic DAO (Data Access Object) with common methods to CRUD POJOs.
 *
 * <p>Extend this interface if you want typesafe (no casting necessary) DAO's for your
 * domain objects.
 *
 * <p>Extended the interface GenericDao from appfuse framework
 *
 * @author txiao
 * @version Revision: 1.0, Date: 23.09.2009
 * @param <T> a type variable
 * @param <PK> the primary key for that type
 */
public interface BasicDao<T, PK extends Serializable> extends GenericDao<T, PK>{
	
	/*
     * Add your function here
     */
	public void saveorupdate(T object) throws ObjectCanNotSaveException;
	
	public int getTotalRows();
	public int getTotalRows(Set<LinkedHashMap<String, Object>> queryParams);
	public long getTotalRows(String queryString);
	
	public List<T> getAll(Set<LinkedHashMap<String, Object>> queryParams, LinkedHashMap<String, String> order);
	
	public List<T> getOnePage(int pageSize, int startRow);
	public List<T> getOnePage(Pager pager);
	
	public List<T> getOnePage(int pageSize, int startRow, Set<LinkedHashMap<String, Object>> queryParams, LinkedHashMap<String, String> order);
	public List<T> getOnePage(Pager pager, Set<LinkedHashMap<String, Object>> queryParams, LinkedHashMap<String, String> order);
		
	public List<T> getOnePage( String queryString, int pageSize, int startRow);
	public List<T> getOnePage( String queryString, Pager pager);
	
}
